package com.huaiwei.usmManager.modules.usm.controller;

import com.huaiwei.usmManager.common.utils.R;
import com.huaiwei.usmManager.modules.usm.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@Api(tags = "用户管理")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
    @ApiOperation("获取用户列表")
    public R list(){
        return R.ok().put("list",userService.list());
    }

    @GetMapping("/info/{userId}")
    @ApiOperation("根据id获取用户")
    public R info(@PathVariable("userId") Integer userId){
        return R.ok().put("data",userService.getById(userId));
    }

}
